package com.jusha.formulacalculation;

import com.jusha.formulacalculation.enums.ResultStatus;

public class Result {
    public double getValue() {
        return value;
    }

    public void setValue(double value) {
        this.value = value;
    }

    public ResultStatus getStatus() {
        return status;
    }

    public void setStatus(ResultStatus status) {
        this.status = status;
    }

    private double value = 0;
    private ResultStatus status;

    public Result(double value) {
        this.value = value;
        this.status = ResultStatus.OK;
    }

    public Result(ResultStatus status) {
        this.status = status;
    }

    public static Result ok(double value) {
        return new Result(value);
    }

    public static Result undefinedFunction() {
        return new Result(ResultStatus.UNDEFINED_FUNCTION);
    }

    public static Result undefinedSymbol() {
        return new Result(ResultStatus.UNDEFINED_SYMBOL);
    }

    public static Result wrongParamCount() {
        return new Result(ResultStatus.WRONG_PARAM_COUNT);
    }

    public static Result resultError() {
        return new Result(ResultStatus.RESULT_ERROR);
    }
}
